import { RouteRecordRaw } from "vue-router";
import Home from "../views/Home.vue";
import UserLayout from "../layout/UserLayout.vue";
import ACCESS_ENUM from "@/access/acessEnum";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/user",
    name: "用户",
    component: UserLayout,
    meta: {
      hide: true,
    },
    children: [
      {
        path: "/user/login",
        name: "登录",
        component: () => import("@/views/user/Login.vue"),
      },
      {
        path: "/user/register",
        name: "注册",
        component: () => import("@/views/user/Register.vue"),
      },
    ],
  },
  {
    path: "/",
    name: "主页",
    component: Home,
  },
  {
    path: "/noAuth",
    name: "无权限",
    component: () => import("@/views/NoAuth.vue"),
    meta: {
      hide: true,
    },
  },
  {
    path: "/admin",
    name: "管理员可见",
    component: () => import("@/views/Admin.vue"),
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/about",
    name: "关于",
    component: () => import("../views/About.vue"),
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },
];
